import 'package:fluplu/router.dart';
import 'package:fluplu/upgrade.dart';
import 'package:fluplu/websocket.dart';
import 'package:fluplu/widget.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
    initXUpdate();
    // 全局注册websocket
    Get.put(WebSocketController());
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Column(
        children: [
          listTileWidget('登录页面', login),
          listTileWidget('NestedScrollPage', nestedScrollPage),
          listTileWidget('Sliver上滑吸顶', sliverPage),
          listTileWidget('版本更新', upgradePage),
          listTileWidget('瀑布流', staggeredPage),
          listTileWidget('上下拉刷新', refreshPage),
          listTileWidget('下拉筛选', gZXDropDownMenuPage),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: const Icon(Icons.refresh),
      ),
    );
  }
}
